﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/MasterPage2.master" AutoEventWireup="True"
    CodeBehind="WarningSetuptime.aspx.cs" Inherits="EarlyWarning_WarningSetuptime" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script type="text/javascript">
    function setValuesHospital() {
        var drop = document.getElementById("<%=dropCity.ClientID%>");
        var currSelectText = drop.options[drop.selectedIndex].value;
        window.open('HospitalSelect.aspx?_AreaId="' + currSelectText + '"', 'HosCompanySelect', 'width=600,height=400,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')

    }
    
    function insertDrugs(Productname, ProductId) {
        document.getElementById("<%=txtDrugsName.ClientID%>").value = Productname;
        document.getElementById("<%=hddGoodsId.ClientID %>").value = ProductId;
    }

    function InsertCompany(companyInfo) {
        var varCompanyInfo = companyInfo.split('|');

        var companyNames = varCompanyInfo[0];
        var companyIDs = varCompanyInfo[1];
        var companyID = document.getElementById("<%=hidCompanyId.ClientID %>");
        var companyName = document.getElementById("<%=txtCompany.ClientID %>");
        companyName.value = companyNames;
        companyID.value = companyIDs;
    }

    function InsertHospital(companyInfo) {
        var varCompanyInfo = companyInfo.split('|');

        var HospitalNames = varCompanyInfo[0];
        var HospitalIDs = varCompanyInfo[1];
        var HospitalID = document.getElementById("<%=hidHospitalId.ClientID %>");
        var HospitalName = document.getElementById("<%=txtHospital.ClientID %>");
        HospitalName.value = HospitalNames;
        HospitalID.value = HospitalIDs;
    }

    function CheckInput() {

        if (document.getElementById("<%=txtTime.ClientID%>").value == "") {
            alert("请输入响应时间");
            return false;
        }
    }
    function seleChangeHospital() {
        document.getElementById("<%=txtHospital.ClientID%>").value = "";
        document.getElementById("<%=hidHospitalId.ClientID%>").value = "";
    }
    function seleChangDrugs() {
        document.getElementById("<%=txtDrugsName.ClientID%>").value = "";
        document.getElementById("<%=hddGoodsId.ClientID%>").value = "";
    }

    function ClearData() {
        document.getElementById("<% =txtHospital.ClientID%>").value = "";
        document.getElementById("<%=hidHospitalId.ClientID %>").value = "";
        document.getElementById("<%=txtDrugsName.ClientID %>").value = "";
        document.getElementById("<%=hddGoodsId.ClientID %>").value = "";
        document.getElementById("<%=txtCompany.ClientID %>").value = "";
        document.getElementById("<%=hidCompanyId.ClientID %>").value = "";
        document.getElementById("<%=txtTime.ClientID %>").value = "";
    }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="tabnav">
        <ul>
            <li><a href="WarningSetup.aspx">药品预警设置</a></li>
            <li class="active"><a href="javascript:void(0);">响应时间预警设置</a></li>
            <li><a href="WarningStared.aspx">已启动的预警</a></li>
            <li><a href="WarningProcessStop.aspx">禁用的预警</a></li>
        </ul>
    </div>
    <div id="tabcontent">
        <table>
            <tr>
                <th>
                    地区
                </th>
                <td>
                    <asp:DropDownList ID="dropCity" runat="server">
                    </asp:DropDownList>
                </td>
                 <th>
                    预警医院
                </th>
                <td>
                    <asp:TextBox ID="txtHospital" runat="server"></asp:TextBox>
                    <input type="button" value="选取医院" onclick="setValuesHospital()" />
                    <asp:HiddenField ID="hidHospitalId" runat="server" />
                </td>
           </tr>
           <tr>
                <th>
                    药品类别
                </th>
                <td>
                    <asp:DropDownList ID="dropType" runat="server">
                    </asp:DropDownList>
                </td>
                <th>
                    药品名称
                </th>
                <td>
                    <asp:TextBox ID="txtDrugsName" runat="server" Enabled="true"></asp:TextBox>
                    <asp:HiddenField ID="hddGoodsId" runat="server" />
                    <input type="button" value="选择" onclick="window.open('DrugsNameSelect.aspx', 'DrugsNameSelect', 'width=600,height=400,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')" />
                </td>
           </tr>
           <tr>
                 <th>
                    预警企业
                </th>
                <td>
                    <asp:TextBox ID="txtCompany" runat="server"></asp:TextBox>
                    <input type="button" value="选取企业" onclick="window.open('CompanySelect.aspx', 'CompanySelect', 'width=600,height=400,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')" />
                    <asp:HiddenField ID="hidCompanyId" runat="server" />
                </td>
                 <th>
                    响应类型
                </th>
                <td>
                    <asp:DropDownList ID="dropListType" runat="server">
                        <asp:ListItem Text="医院已提交采购单企业未确认" Value="0"></asp:ListItem>
                        <asp:ListItem Text="企业已确认定单医院未入库" Value="1"></asp:ListItem>
                        <asp:ListItem Text="企业已开发票中心未审核" Value="2"></asp:ListItem>
                        <asp:ListItem Text="医院已提交退货单企业未确认" Value="3"></asp:ListItem>
                        <asp:ListItem Text="医院已提交回款单企业未确认" Value="4"></asp:ListItem>
                        <asp:ListItem Text="医院已入库未回款" Value="5"></asp:ListItem>
                    </asp:DropDownList>
                </td>
           </tr>
            <tr>
                <th>
                    预警级别
                </th>
                <td>
                     <asp:DropDownList ID="dropJiebie" runat="server">
                        <asp:ListItem Text="一级预警" Value="1"></asp:ListItem>
                        <asp:ListItem Text="二级预警" Value="2"></asp:ListItem>
                        <asp:ListItem Text="三级预警" Value="3"></asp:ListItem>
                    </asp:DropDownList>
                </td>
                <th>
                    响应时间
                </th>
                <td>
                    <asp:TextBox ID="txtTime" runat="server"></asp:TextBox>
                    <asp:DropDownList ID="dropTime" runat="server">
                        <asp:ListItem Text="天"></asp:ListItem>
                        <asp:ListItem Text="周"></asp:ListItem>
                        <asp:ListItem Text="月"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td colspan="4" align="center">
                   
                    <asp:Button ID="btnEnter" runat="server" Text="确定定制" OnClick="btnEnter_Click" />
                    &nbsp;&nbsp;
                    <input type="button" value="清空数据"  onclick="ClearData()"/>
                </td>
            </tr>
            <tr>
                <td colspan="4" align="center">
                    &nbsp;
                </td>
            </tr>
        </table>
        <asp:GridView ID="gridInfo" runat="server" AutoGenerateColumns="false" CssClass="mainlist"
            OnRowDataBound="gridInfo_RowDataBound">
            <EmptyDataTemplate>
                <div>
                    <label style="color: Red">
                        暂时没有你要的数据！</label></div>
            </EmptyDataTemplate>
            <Columns>
                <asp:TemplateField HeaderText="序号">
                    <ItemTemplate>
                        <%# Container.DataItemIndex+1+(AspNetPager1.CurrentPageIndex-1)*AspNetPager1.PageSize %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="地区" DataField="AreaName" />
                <asp:BoundField HeaderText="医院" DataField="HospitalName" NullDisplayText="所有医院" />
                <asp:BoundField HeaderText="企业" DataField="CompanyName" NullDisplayText="所有企业" />
                <asp:BoundField HeaderText="药品类别" DataField="SortName" NullDisplayText="所有类别" />
                <asp:BoundField HeaderText="药品名称" DataField="ProductName" NullDisplayText="所有药品" />
                <asp:TemplateField HeaderText="响应类型">
                    <ItemTemplate>
                        <asp:Label ID="labType" runat="server" Text='<%#Eval("WarningType") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="响应时间">
                    <ItemTemplate>
                        <label id="LabTime"><%#Eval("WarningDate")%>天</label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="响应级别">
                    <ItemTemplate>
                        <asp:Label ID="labLeve" runat="server" Text='<%#Eval("WarningLevel") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="制定时间" DataField="AddTime" />
                <asp:TemplateField HeaderText="是否启用">
                    <ItemTemplate>
                        <label id="lab"><%#Eval("IsUsing").ToString()=="True"?"已启用":"未启用" %></label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <div class="page">
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged">
        </webdiyer:AspNetPager>
    </div>
</asp:Content>
